package com.ruoyi.cderp.controller;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.cderp.domain.TblPurchaseConfig;
import com.ruoyi.cderp.service.ITblPurchaseConfigService;

/**
 * 采购参数设置Controller
 * 
 * @author ruoyi
 * @date 2025-02-17
 */
@RestController
@RequestMapping("/system/purchaseConfig")
public class TblPurchaseConfigController extends BaseController
{
    @Autowired
    private ITblPurchaseConfigService tblPurchaseConfigService;

    /**
     * 查询采购参数设置
     */
    @PreAuthorize("@ss.hasPermi('system:purchaseConfig:index')")
    @GetMapping("/index")
    public AjaxResult index()
    {
        return success(tblPurchaseConfigService.selectTblPurchaseConfig());
    }


    /**
     * 修改采购参数设置
     */
    @PreAuthorize("@ss.hasPermi('system:purchaseConfig:edit')")
    @Log(title = "采购参数设置", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TblPurchaseConfig tblPurchaseConfig)
    {
        return toAjax(tblPurchaseConfigService.updateTblPurchaseConfig(tblPurchaseConfig));
    }
}
